package com.sicheng.lc.周赛.分类.模拟;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/6/30 21:18
 */
public class 使数组变成交替数组的最少操作数 {
    //https://leetcode.cn/problems/minimum-operations-to-make-the-array-alternating/


    public int minimumOperations(int[] nums) {
        return -1;
    }

    private int count(int[] nums, int x, int y) {
        int cnt = 0;
        for (int i = 0; i < nums.length; i++) {
            if ((i & 1) == 0 && nums[i] != x)
                cnt++;
            if ((i & 1) == 1 && nums[i] != y)
                cnt++;
        }
        return cnt;
    }

    private int candi(int[] nums, int start, int out) {
        int cnt = 0;
        int candidate = 0;
        for (int i = start; i < nums.length; i += 2) {
            if (out == nums[i])
                continue;
            if (nums[i] == candidate) {
                cnt++;
            } else if (cnt - 1 > 0) {
                cnt--;
            } else {
                candidate = nums[i];
                cnt = 1;
            }
        }
        return candidate;
    }
}
